package com.example.demo.VO;

import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@Data
public class CreditVo {
    private String cardNumber;
    private String cardCvv;
    private Long userId;
    private Double balance;
    private LocalDate expireDate;
    private Integer status;
    private LocalDateTime createTime;
    private LocalDateTime updateTime;
    public String getFormattedDate() {
        return expireDate.format(DEFAULT_FORMATTER);
    }
    // DateTime 的格式化方法
    public String getFormattedDateTime() {
        updateTime.format(DEFAULT_FORMATTER);
        return createTime.format(DATETIME_FORMATTER);
    }
    private static final DateTimeFormatter DEFAULT_FORMATTER =
            DateTimeFormatter.ofPattern("yyyy-MM-dd");
    private static final DateTimeFormatter DATETIME_FORMATTER =
            DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
}
